package cn.zlb.frame.domain.pay.model.valueobj;

import cn.zlb.frame.common.enums.IBaseEnum;

/**
 * @author yangjie.deng@resico.cn
 * @date 2023-11-09 14:15:42
 * @describe class responsibility
 */
public enum PayStatusValueObj implements IBaseEnum {
    NON_PAY(1, "未支付"),
    PAY_DURING(2, "支付中"),
    PAY_SUCCESS(3, "支付成功"),
    PAY_FAILED(4, "支付失败")
    ;

    private final int value;
    private final String name;

    PayStatusValueObj(int value, String name) {
        this.value = value;
        this.name = name;
    }


    @Override
    public String getName() {
        return this.name;
    }

    @Override
    public Integer getValue() {
        return this.value;
    }

    public static PayStatusValueObj findValue(int value) {
        for (PayStatusValueObj obj : values()) {
            if (value == obj.getValue()) {
                return obj;
            }
        }
        throw new RuntimeException("状态错误[" + value + "], 不属于取值范围内.");
    }
}
